package com.shawn.dubbo.api;

import com.shawn.model.mongo.Report;
import org.apache.dubbo.config.annotation.DubboService;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;

import java.util.List;

/**
 * @author shawn
 * @date 2022年 11月 11日 21:23
 */

@DubboService
public class ExaminationSoulApiImpl implements ExaminationSoulApi{

    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public List<Report> getAllReport() {
        return mongoTemplate.findAll(Report.class);
    }

    @Override
    public Report getReportById(String id) {
        return mongoTemplate.findById(new ObjectId(id),Report.class);
    }
}
